package com.woniu.atms.config;

import com.woniu.atms.filter.AftJWTFilter;
import com.woniu.atms.filter.CorssFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 张奇
 * @title: ATMSFilterConfig
 * @projectName g5_atms
 * @description: TODO
 * @date 2022/1/24 15:01
 */
@Configuration
public class ATMSFilterConfig {

        @Bean
    public FilterRegistrationBean<CorssFilter> crossFilterFilterRegistrationBean(){
        FilterRegistrationBean<CorssFilter> filterFilterRegistrationBean = new FilterRegistrationBean<>();
        filterFilterRegistrationBean.setFilter(new CorssFilter());
        filterFilterRegistrationBean.addUrlPatterns("/api/*");
        filterFilterRegistrationBean.setOrder(1);
        return filterFilterRegistrationBean;
    }
//
//
//    @Bean
//    public FilterRegistrationBean<AftJWTFilter> authenticationFilterFilterRegistrationBean(){
//        FilterRegistrationBean<AftJWTFilter> filterFilterRegistrationBean = new FilterRegistrationBean<>();
//        filterFilterRegistrationBean.setFilter(new AftJWTFilter());
//        filterFilterRegistrationBean.addUrlPatterns("/api/aft/v1/*");
//        filterFilterRegistrationBean.setOrder(2);
//        return filterFilterRegistrationBean;
//    }
}
